package demo2;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Test {
    public static void main(String[] args) {
        Student stu = new Student();
       // stu.game("吃鸡");

        StuInterface pro= (StuInterface) Proxy.newProxyInstance(stu.getClass().getClassLoader(), new Class[]{StuInterface.class},
                new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                return method.invoke(stu,args);

                /*
                 if("game".equals(method.getName())){
                    System.out.println("卧槽");
                    return null;
                }else {
                    return method.invoke(stu.args);
                }*/

            }
        });
        pro.game("lol");
    }
}
